package com.cdc.shapeofview;
import androidx.appcompat.app.AppCompatActivity;

import android.animation.ValueAnimator;
import android.os.Bundle;

import com.github.florent37.shapeofview.shapes.ArcView;
public class ShapeOfViewStarAnimatedActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.shape_of_view_star_wars_animated);
        final ArcView arcLayout=findViewById(R.id.arcLayout);
        if (arcLayout != null) {
            ValueAnimator mValueAnimator=ValueAnimator.ofFloat(0f, -200f, 200f);
            mValueAnimator.setRepeatCount(ValueAnimator.INFINITE);
            mValueAnimator.setRepeatMode(ValueAnimator.REVERSE);
            mValueAnimator.setDuration(5000);
            mValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
                @Override
                public void onAnimationUpdate(ValueAnimator valueAnimator) {
                    arcLayout.setArcHeight((Float) valueAnimator.getAnimatedValue());
                }
            });
            mValueAnimator.start();
        }

    }
}
